﻿<%@ Page Title="" Language="C#" MasterPageFile="~/article/MasterPage.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="topic_Default" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <link href="../skin/jquery-ui.css" rel="Stylesheet" type="text/css" />
    <script src="../js/jquery-1.4.1.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="../js/jquery-ui.min.js"></script>
    <script type="text/javascript" src="../js/jquerypage.js"></script>
    <link href="../skin/pagination.css" rel="Stylesheet" type="text/css" />
    <script type="text/javascript">
        $(document).ready(function () {
        document.title="讨论区";
            getpagecount();
        });
        function getpagecount() { 
            $.getJSON("../Handles/TopicHandler.ashx",{"act":"getcount"},function(data){
                $("#page").pagination(data.count, {
                    callback: gettopic,
                    prev_text: "上一页",
                    next_text: "下一页",
                    items_per_page: 10,
                    num_display_entries: 6,
                    current_page: 1,
                    num_edge_entries: 2,
                });
            });
        }

        function gettopic(page) {
            var postdata = { "act": "get", "page": page }
            $.ajax({
                url: "../Handles/TopicHandler.ashx",
                data: postdata,
                dataType: "json",
                success: function (data) {
                    $("#topics").accordion("destroy");
                    $("#topics").html("");
                    var json = data.Data;
                    $(json).each(function () {
                        var html = "";
                        html += '<h3><a href="#">' + this.Title + '</a></h3>';
                        html += '<div><p style="float:right"><a href="topic.aspx?tid='+this.TopicID+'" target="_bank"><span style="color:red">交流一下</span></a></p>' + this.Content + '</div>';
                        $("#topics").append(html);
                    });
                    $("#topics").accordion({active:false});
                }
            });
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ArticleTitle" Runat="Server">
   <h2>讨论区</h2>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ArticleContent" Runat="Server">
    <div id="topics">
    </div>
    <div id="page" style="text-align:center" class="pagination">
         </div>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="rightsidebar" Runat="Server">
    <alien:NewArticleBox ID="NewArticle" runat="server" PageUrl="../article/" />
    <alien:HotArticleBox ID="HotArticle" runat="server" PageUrl="../article/" />
</asp:Content>

